# -*- coding: utf-8 -*-
# @Author: QX
# @File: day7_0075swipe.py
from time import sleep

from appium.webdriver.common.appiumby import AppiumBy

'''
6.滑动和拖拽事件swipe,scroll,drag_and_drop
driver.swipe(startX,startY,endX,endY,duration=None)
driver.scroll(ele1,ele2)
driver.drag_and_drop(ele1,ele2)
'''
from  appium   import webdriver
dic = {
  "platformName": "Android",
  "appium:platformVersion": "9",
  "appium:appPackage": "com.android.settings",
  "appium:appActivity": ".Settings",
  "appium:deviceName": "emulator-5554",
  "appium:automationName": "UIAutomator2"
}
driver = webdriver.Remote('http://127.0.0.1:4723',dic)
driver.implicitly_wait(30)
driver.swipe(500,1000,500,600,duration=500)
sleep(2)
ele1 = driver.find_element(AppiumBy.XPATH,'//*[@text="声音"]')
ele2 = driver.find_element(AppiumBy.XPATH,'//*[@text="帐号"]')
driver.scroll(ele1,ele2)
driver.press_keycode(3)
